home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / s / supremov3.00a1.dms / supremov3.00a1.adf / S / Make_DB_qq.sm < prev    next >
Text File  |  1992-04-01  |  2KB  |  64 lines

  1. /*******************************************************************************
  2.  *
  3.  *   Make_DB_qq.sm                     Copyright (c) 28.06.1995, K. Wojcieszek
  4.  *
  5.  *   Program uruchomiony pod SuperMemo v3.0 (lub nowszym) dopisuje
  6.  *   teksty pytaï i odpowiedzi do aktualnie otwartej bazy w SuperMemo
  7.  *   îâczâc pytanie w jednâ linië (Q: abc    Q: def   ->    Q: abcdef)
  8.  *   (najczëôciej jest to baza pusta) z edytora AmiTekst PRO (AmiTekst_port),
  9.  *   lub innego wyposaûonego w port Arexx-a.
  10.  *
  11.  *   Wersja 2.00
  12.  *
  13.  *******************************************************************************/
  14.  
  15. OPTIONS RESULTS
  16. ADDRESS 'rexx_sm'
  17.  
  18. CR = '0A'X                    /* CR - znak koïca linii */
  19.  
  20. sm_to_add                    /* Przejdú w tryb dodawania */
  21.  
  22. ADDRESS 'AmiTekst_port' STATUS NumLines
  23. NumLines = RESULT                /* NumLines - liczba linii tekstu */
  24.  
  25. l = 1;  question = '';  answer = '';  rep = ''
  26. DO while (l <= NumLines)
  27.     ADDRESS 'AmiTekst_port' JumpToLine l        /* Ustaw kursor w linii: l */
  28.     ADDRESS 'AmiTekst_port' BegOfLine            /* Ustaw kursor na poczâtku linii */
  29.     ADDRESS 'AmiTekst_port' STATUS LineBuffer
  30.     line = RESULT                                /* Pobierz zawartoôê aktualnej linii */
  31.     l = l + 1
  32.     if substr(line, 1, 2) = 'Q:' then
  33.     DO
  34.         if question = '' then
  35.             question = delstr(line, 1, 3)
  36.         else
  37.         DO
  38.             i = index(question, CR)
  39.             if i > 0 then
  40.                 question = delstr(question, i, 1) || ' ' || delstr(line, 1, 3)
  41.             else
  42.                 question = question || delstr(line, 1, 3)
  43.         END
  44.     END
  45.     else
  46.     if substr(line, 1, 2) = 'A:' then            /* Formatowanie odpowiedzi */
  47.         answer = answer || delstr(line, 1, 3)
  48.     else
  49.     if substr(line, 1, 2) = 'I:' then            /* Formatowanie odpowiedzi */
  50.         rep = delstr(line, 1, 3)
  51.     else
  52.     if line = CR then                            /* Jednostka kompletna */
  53.     DO
  54.         sm_put_q question
  55.         sm_put_a answer
  56.         if rep ~= '' then  sm_put_rep rep
  57.         sm_write                                /* Zapis do bazy */
  58.         if RESULT = 'RESULT' then LEAVE
  59.         question = '';  answer = '';  rep = ''
  60.     END
  61. END
  62.  
  63. sm_to_end                                        /* Zamknij okno dodawania */
  64.